package com.tudouji.project.mt.http.request;

import com.google.gson.reflect.TypeToken;
import com.meituan.sdk.MeituanRequest;
import com.meituan.sdk.MeituanResponse;
import com.meituan.sdk.annotations.ApiMeta;
import com.meituan.sdk.internal.utils.JsonUtil;
import com.tudouji.project.mt.http.response.AppAuthTokenResponse;
import com.tudouji.project.mt.http.response.PoiStockInItemResponse;
import lombok.Data;

import java.lang.reflect.Type;

/**
 * 业务授权刷新
 */
@ApiMeta(
        path = "/oauth/refresh",
        businessId = 18,
        apiVersion = "",
        apiName = "",
        needAuth = true
)
@Data
public class AppAuthTokenRefreshRequest implements MeituanRequest<AppAuthTokenResponse> {

    private Long timestamp;

    private String sign;

    private String scope;

    private String refreshToken;

    private String grantType;

    private Long developerId;

    private String charset;

    private Integer businessId;

    @Override
    public MeituanResponse<AppAuthTokenResponse> deserializeResponse(String response) {
        Type type = new TypeToken<MeituanResponse<AppAuthTokenResponse>>(){}.getType();
        return JsonUtil.fromJson(response, type);
    }
    @Override
    public String serializeToJson() {
        return JsonUtil.toJson(this);
    }
}
